\(\int \frac {(c+d x^2)^2}{x^2 (a+b x^2)} \, dx\) [215]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 22, antiderivative size = 55 \[ \int \frac {\left (c+d x^2\right )^2}{x^2 \left (a+b x^2\right )} \, dx=-\frac {c^2}{a x}+\frac {d^2 x}{b}-\frac {(b c-a d)^2 \arctan \left (\frac {\sqrt {b} x}{\sqrt {a}}\right )}{a^{3/2} b^{3/2}} \]

[Out]

-c^2/a/x+d^2*x/b-(-a*d+b*c)^2*arctan(x*b^(1/2)/a^(1/2))/a^(3/2)/b^(3/2)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.091, Rules used = {472, 211} \[ \int \frac {\left (c+d x^2\right )^2}{x^2 \left (a+b x^2\right )} \, dx=-\frac {\arctan \left (\frac {\sqrt {b} x}{\sqrt {a}}\right ) (b c-a d)^2}{a^{3/2} b^{3/2}}-\frac {c^2}{a x}+\frac {d^2 x}{b} \]

[In]

Int[(c + d*x^2)^2/(x^2*(a + b*x^2)),x]

[Out]

-(c^2/(a*x)) + (d^2*x)/b - ((b*c - a*d)^2*ArcTan[(Sqrt[b]*x)/Sqrt[a]])/(a^(3/2)*b^(3/2))

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 472

Int[(((e_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^(n_))^(p_))/((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Int[ExpandIntegr
and[(e*x)^m*((a + b*x^n)^p/(c + d*x^n)), x], x] /; FreeQ[{a, b, c, d, e, m}, x] && NeQ[b*c - a*d, 0] && IGtQ[n
, 0] && IGtQ[p, 0] && (IntegerQ[m] || IGtQ[2*(m + 1), 0] ||  !RationalQ[m])

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {d^2}{b}+\frac {c^2}{a x^2}-\frac {(-b c+a d)^2}{a b \left (a+b x^2\right )}\right ) \, dx \\ & = -\frac {c^2}{a x}+\frac {d^2 x}{b}-\frac {(b c-a d)^2 \int \frac {1}{a+b x^2} \, dx}{a b} \\ & = -\frac {c^2}{a x}+\frac {d^2 x}{b}-\frac {(b c-a d)^2 \tan ^{-1}\left (\frac {\sqrt {b} x}{\sqrt {a}}\right )}{a^{3/2} b^{3/2}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.04 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.00 \[ \int \frac {\left (c+d x^2\right )^2}{x^2 \left (a+b x^2\right )} \, dx=-\frac {c^2}{a x}+\frac {d^2 x}{b}-\frac {(-b c+a d)^2 \arctan \left (\frac {\sqrt {b} x}{\sqrt {a}}\right )}{a^{3/2} b^{3/2}} \]

[In]

Integrate[(c + d*x^2)^2/(x^2*(a + b*x^2)),x]

[Out]

-(c^2/(a*x)) + (d^2*x)/b - ((-(b*c) + a*d)^2*ArcTan[(Sqrt[b]*x)/Sqrt[a]])/(a^(3/2)*b^(3/2))

Maple [A] (verified)

Time = 2.67 (sec) , antiderivative size = 65, normalized size of antiderivative = 1.18

method result size
default \(\frac {d^{2} x}{b}+\frac {\left (-a^{2} d^{2}+2 a b c d -b^{2} c^{2}\right ) \arctan \left (\frac {b x}{\sqrt {a b}}\right )}{b a \sqrt {a b}}-\frac {c^{2}}{a x}\) \(65\)
risch \(\frac {d^{2} x}{b}-\frac {c^{2}}{a x}-\frac {a \ln \left (-\sqrt {-a b}\, x -a \right ) d^{2}}{2 b \sqrt {-a b}}+\frac {\ln \left (-\sqrt {-a b}\, x -a \right ) c d}{\sqrt {-a b}}-\frac {b \ln \left (-\sqrt {-a b}\, x -a \right ) c^{2}}{2 \sqrt {-a b}\, a}+\frac {a \ln \left (-\sqrt {-a b}\, x +a \right ) d^{2}}{2 b \sqrt {-a b}}-\frac {\ln \left (-\sqrt {-a b}\, x +a \right ) c d}{\sqrt {-a b}}+\frac {b \ln \left (-\sqrt {-a b}\, x +a \right ) c^{2}}{2 \sqrt {-a b}\, a}\) \(178\)

[In]

int((d*x^2+c)^2/x^2/(b*x^2+a),x,method=_RETURNVERBOSE)

[Out]

d^2*x/b+1/b/a*(-a^2*d^2+2*a*b*c*d-b^2*c^2)/(a*b)^(1/2)*arctan(b*x/(a*b)^(1/2))-c^2/a/x

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 164, normalized size of antiderivative = 2.98 \[ \int \frac {\left (c+d x^2\right )^2}{x^2 \left (a+b x^2\right )} \, dx=\left [\frac {2 \, a^{2} b d^{2} x^{2} - 2 \, a b^{2} c^{2} - {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt {-a b} x \log \left (\frac {b x^{2} + 2 \, \sqrt {-a b} x - a}{b x^{2} + a}\right )}{2 \, a^{2} b^{2} x}, \frac {a^{2} b d^{2} x^{2} - a b^{2} c^{2} - {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt {a b} x \arctan \left (\frac {\sqrt {a b} x}{a}\right )}{a^{2} b^{2} x}\right ] \]

[In]

integrate((d*x^2+c)^2/x^2/(b*x^2+a),x, algorithm="fricas")

[Out]

[1/2*(2*a^2*b*d^2*x^2 - 2*a*b^2*c^2 - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*sqrt(-a*b)*x*log((b*x^2 + 2*sqrt(-a*b)*x
 - a)/(b*x^2 + a)))/(a^2*b^2*x), (a^2*b*d^2*x^2 - a*b^2*c^2 - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*sqrt(a*b)*x*arct
an(sqrt(a*b)*x/a))/(a^2*b^2*x)]

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 165 vs. \(2 (44) = 88\).

Time = 0.30 (sec) , antiderivative size = 165, normalized size of antiderivative = 3.00 \[ \int \frac {\left (c+d x^2\right )^2}{x^2 \left (a+b x^2\right )} \, dx=\frac {\sqrt {- \frac {1}{a^{3} b^{3}}} \left (a d - b c\right )^{2} \log {\left (- \frac {a^{2} b \sqrt {- \frac {1}{a^{3} b^{3}}} \left (a d - b c\right )^{2}}{a^{2} d^{2} - 2 a b c d + b^{2} c^{2}} + x \right )}}{2} - \frac {\sqrt {- \frac {1}{a^{3} b^{3}}} \left (a d - b c\right )^{2} \log {\left (\frac {a^{2} b \sqrt {- \frac {1}{a^{3} b^{3}}} \left (a d - b c\right )^{2}}{a^{2} d^{2} - 2 a b c d + b^{2} c^{2}} + x \right )}}{2} + \frac {d^{2} x}{b} - \frac {c^{2}}{a x} \]

[In]

integrate((d*x**2+c)**2/x**2/(b*x**2+a),x)

[Out]

sqrt(-1/(a**3*b**3))*(a*d - b*c)**2*log(-a**2*b*sqrt(-1/(a**3*b**3))*(a*d - b*c)**2/(a**2*d**2 - 2*a*b*c*d + b
**2*c**2) + x)/2 - sqrt(-1/(a**3*b**3))*(a*d - b*c)**2*log(a**2*b*sqrt(-1/(a**3*b**3))*(a*d - b*c)**2/(a**2*d*
*2 - 2*a*b*c*d + b**2*c**2) + x)/2 + d**2*x/b - c**2/(a*x)

Maxima [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 63, normalized size of antiderivative = 1.15 \[ \int \frac {\left (c+d x^2\right )^2}{x^2 \left (a+b x^2\right )} \, dx=\frac {d^{2} x}{b} - \frac {c^{2}}{a x} - \frac {{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \arctan \left (\frac {b x}{\sqrt {a b}}\right )}{\sqrt {a b} a b} \]

[In]

integrate((d*x^2+c)^2/x^2/(b*x^2+a),x, algorithm="maxima")

[Out]

d^2*x/b - c^2/(a*x) - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*arctan(b*x/sqrt(a*b))/(sqrt(a*b)*a*b)

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 63, normalized size of antiderivative = 1.15 \[ \int \frac {\left (c+d x^2\right )^2}{x^2 \left (a+b x^2\right )} \, dx=\frac {d^{2} x}{b} - \frac {c^{2}}{a x} - \frac {{\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \arctan \left (\frac {b x}{\sqrt {a b}}\right )}{\sqrt {a b} a b} \]

[In]

integrate((d*x^2+c)^2/x^2/(b*x^2+a),x, algorithm="giac")

[Out]

d^2*x/b - c^2/(a*x) - (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*arctan(b*x/sqrt(a*b))/(sqrt(a*b)*a*b)

Mupad [B] (verification not implemented)

Time = 0.08 (sec) , antiderivative size = 80, normalized size of antiderivative = 1.45 \[ \int \frac {\left (c+d x^2\right )^2}{x^2 \left (a+b x^2\right )} \, dx=\frac {d^2\,x}{b}-\frac {c^2}{a\,x}-\frac {\mathrm {atan}\left (\frac {\sqrt {b}\,x\,{\left (a\,d-b\,c\right )}^2}{\sqrt {a}\,\left (a^2\,d^2-2\,a\,b\,c\,d+b^2\,c^2\right )}\right )\,{\left (a\,d-b\,c\right )}^2}{a^{3/2}\,b^{3/2}} \]

[In]

int((c + d*x^2)^2/(x^2*(a + b*x^2)),x)

[Out]

(d^2*x)/b - c^2/(a*x) - (atan((b^(1/2)*x*(a*d - b*c)^2)/(a^(1/2)*(a^2*d^2 + b^2*c^2 - 2*a*b*c*d)))*(a*d - b*c)
^2)/(a^(3/2)*b^(3/2))